<?php
$plugin->load_plugin_lang();

$activity_id = $_GET['activity_id'];
$nb_categories = $Sql->Query("SELECT nb_categories FROM ".PREFIX."plugin_dragdrop_features WHERE id=".$activity_id."",__LINE__,__FILE__);
$nb_entities = $Sql->Query("SELECT nb_entities FROM ".PREFIX."plugin_dragdrop_features WHERE id=".$activity_id."",__LINE__,__FILE__);


for($i=0; $i<=5; $i++)
{
	for($j=0; $j<=10; $j++)
	{
		$input[$i][$j] = "0";
	}
}

for($j=1; $j<=$nb_categories; $j++)
{
	$input[$j][0] = retrieve(POST, 'categ_'.$j , '');
	
	for($k=1; $k<=$nb_entities; $k++)
	{
		$input[$j][$k] = retrieve(POST, 'enti_'.$k.'_'.$j , '');
	}
}

for($a=1; $a<=$nb_categories; $a++)
{
	$Sql->query_inject("UPDATE phpboost_plugin_dragdrop SET category_name = '".$input[$a][0]."' , entity_1 = '".$input[$a][1]."' , entity_2 = '".$input[$a][2]."' , entity_3 = '".$input[$a][3]."' , entity_4 = '".$input[$a][4]."' , entity_5 = '".$input[$a][5]."' , entity_6 = '".$input[$a][6]."' , entity_7 = '".$input[$a][7]."' , entity_8 = '".$input[$a][8]."' , entity_9 = '".$input[$a][9]."' , entity_10 = '".$input[$a][10]."'			
						WHERE id=".$activity_id." AND category_id=".$a." ",__LINE__,__FILE__);
	
}

$plugin->edit_module($module->get_module_id_created_module());
?>